<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>标体顾客</title>
		<meta http-equiv="Pragma" CONTENT="no-cache">
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<meta name="renderer" content="webkit">
		<link rel="stylesheet" href="${cxt!}/sb/plugins/ztree/css/zTreeStyle/zTreeStyle.css" type="text/css">
		<script src="http://echarts.baidu.com/build/dist/echarts.js"></script>
		<%include("/common/include.html"){}%>
		<style type="text/css">
		.textbox {
			padding-right: 0px;
			background: url("${cxt !}/sb/themes/insdep/images/combo_arrow.png")
				no-repeat scroll right center transparent;
		}
		</style>
	</head>
	
	<body class="easyui-layout">
			<div data-options="region:'north',split: true,title:'快速查询'" style="height:200px;padding:10px;">
				<form id="standardCustomer_Form"  method="post">
					<div style="margin-bottom: 10px;float:left;margin-right: 10px;">
						<label class="label-top" style="width: 100%; display: block;">店面名称：</label>
						<input id="organ" type="text" readonly style="width: 200px; height: 30px; padding-left: 10px;border-radius:3px" onclick="showMenu(); return false;" class="textbox" value="${organization.name! }"/>
						<input name="_query.organIds" id="organIds" value="f4b48befcc944561b52409e8f2d1969c" type="hidden">
					</div>
					<div style="margin-bottom: 10px;float:left;margin-right: 10px;">
						<label class="label-top" style="width: 100%; display: block;">开始日期：</label>
						<input name="_query.startDate" id="startDate" value='${date()}' class="easyui-datebox theme-textbox-radius" style="height:32px;width:212px;text-align:center">
					</div>
					<div style="margin-bottom: 10px;float:left;margin-right: 10px;">
						<label class="label-top" style="width: 100%; display: block;">结束日期：</label>
						<input name="_query.endDate" id="endDate" value='${date()}' class="easyui-datebox theme-textbox-radius" style="height:32px;width:212px;text-align:center">
					</div>
					<div style="margin-bottom: 10px;float:left;margin-top: 16px;margin-right: 10px;">
						<a href="#" onclick="searchFrom()" class="easyui-linkbutton" data-options="iconCls:'icon-search'" style="height:32px;width:212px;text-align:center">搜索</a>
					</div>
					<div style="margin-bottom: 10px;float:left;margin-top: 16px;margin-right: 10px;">
						<a href="#" onclick='customerInfo_xls()' class="easyui-linkbutton" data-options="iconCls:'icon-pageexcel'" style="width:212px">导出</a>
					</div>
				</form>
			</div>
			<div data-options="region:'center',border: false" style="overflow-x:hidden;">
				<table id="standardCustomer_datagrid" class="easyui-datagrid" data-options="fitColumns:true" style="width:100%;height:auto;">
					<thead>	
						<tr>
							<th data-options="field:'hybh',width:80,align:'center'">编号</th>
							<th data-options="field:'name',width:80,align:'center'">姓名</th>
							<!-- <th data-options="field:'phone',width:80,align:'center'">手机号码</th> -->
							<th data-options="field:'jdrq',width:80,align:'center'">进店日期</th>
							<th data-options="field:'weight',width:80,align:'center'">首次体重</th>     
							<th data-options="field:'std_weight',width:80,align:'center'">标准体重</th>
							<th data-options="field:'nowweight',width:80,align:'center'">最新体重</th>
						</tr>
					</thead>
				</table>	
							
			</div>
			<div id="menuContent" class="menuContent" style="display: none; position: absolute;z-index: 10;">
				<ul id="organSelectTree" class="ztree" style="margin-top:0;width: 200px;"></ul>
			</div>	
		<script type="text/javascript">
		//快速查询面板自适应
		var $form = $("#standardCustomer_Form");		
		$(document).ready(function (){
			var $form_div = $("#standardCustomer_Form div");
			winResize($form_div);
			$(window).resize(function(){
				winResize($form_div);
			});
		});
		//加载表格
		function  loadTable()
		{	
			$('#standardCustomer_datagrid').datagrid({
				  queryParams: {
					'_query.organIds': $("#organIds").val(),
					'_query.startDate': $("#startDate").val(),
					'_query.endDate': $("#endDate").val()
				  },
				  singleSelect:true,  
				  rownumbers: true,
				  fitColumns:true,
				  collapsible: true,
				  url: "standardCustomer/queryStandard",
				  queryParams: sy.serializeObject($form),
				  method: 'post'
			});
		} 
		//查询表格内容
		function  searchFrom()
		{
			loadTable();
		}
		//导出表格
		function customerInfo_xls(){
			var startDate = $("#startDate").val();
			var endDate = $("#endDate").val();
			var organIds = $("#organIds").val();
			var url = "${cxt!}/standardCustomer/excel?startDate="+startDate+"&endDate="+endDate+"&organIds="+organIds;
			window.location.href = url;
		}
		</script>
		<script type="text/javascript">
			var setting = {
				async : {
					enable : true,
					url : '${cxt!}/common/getOrgenTree',
					autoParam : [ "id=ids" ],//, "name=n", "level=lv"
					type : "post"
				},
				view : {
					dblClickExpand : false
				},
				data : {
					simpleData : {
						enable : true
					}
				},
				callback : {
					onClick : onClick,
					onAsyncSuccess : organTreeOnAsyncSuccess
				}
			};
			var flag=0;//只初始化一次标识
			function organTreeOnAsyncSuccess(event, treeId, msg) {
				if(flag == 0){
					flag = 1;
				}
			}
			function onClick(e, treeId, treeNode) {
				var zTree = $.fn.zTree.getZTreeObj("organSelectTree");
				var path = "";
				var sNodes = zTree.getSelectedNodes();
				if (sNodes.length > 0) {
					var node = sNodes[0].getPath();
					for(var i =0;i<node.length;i++){
						if(i == (node.length-1)){
							path += node[i].name;
						}else{
							path += node[i].name + "/";
						}
					}
				}
				var cityObj = $("#organ");
				cityObj.attr("value", path);
				$("#organIds").attr("value", treeNode.id);
				hideMenu();
			}
			function showMenu() {
				var cityObj = $("#organ");
				var cityOffset = $("#organ").offset();
				$("#menuContent").css({
					left : cityOffset.left + "px",
					top : cityOffset.top + cityObj.outerHeight() + "px"
				}).slideDown("fast");
		
				$("body").bind("mousedown", onBodyDown);
			}
			function hideMenu() {
				$("#menuContent").fadeOut("fast");
				$("body").unbind("mousedown", onBodyDown);
			}
			function onBodyDown(event) {
				if (!(event.target.id == "menuBtn"
						|| event.target.id == "menuContent" || $(event.target)
						.parents("#menuContent").length > 0)) {
					hideMenu();
				}
			}
			$.fn.zTree.init($("#organSelectTree"), setting);
		</script>
		
	</body>
</html>
